<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>友情链接</title>

  <link rel="stylesheet" href="../assets/lib/layui/css/layui.css">
  <link rel="stylesheet" href="../assets/css/resourse/link.css">
</head>

<body>
  <div class="layui-card">
    <div class="layui-card-header">友情链接
    <button type="button" class="layui-btn" id="addBtn">添加链接</button>
    </div>
    <div class="layui-card-body">
      <table class="layui-table">
        <colgroup>
          <col width="100">
          <col width="200">
          <col width="300">
          <col width="500">
          <col width="200">
          <col width="300">

        </colgroup>
        <thead>
          <tr>
            <th>ID</th>
            <th>链接图标</th>
            <th>链接名称</th>
            <th>链接地址</th>
            <th>链接描述</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <!-- <tr>
            <td>1</td>
            <td>img</td>
            <td>阿里云</td>
            <td>链接地址</td>
            <td>阿里云</td>
            <td>
              <button type="button" class="layui-btn layui-btn-sm " id="del">编辑</button></td>
            <button type="button" class="layui-btn layui-btn-sm layui-btn-danger" id="del">删除</button></td>
          </tr> -->
        </tbody>

      </table>

    </div>
    <!-- 设置链接的模板 -->
    <script type="text/html" id="tpl-link">
       {{each data val}}
          <tr>
              <td>{{val.id}}</td>
              <td><img src="http://localhost:8888/uploads/{{val.linkicon}}" alt="" style="background:black"></td>
              <td>{{val.linkname}}</td>
              <td>{{val.linkurl}}</td>
              <td>{{val.linkdesc}}</td>
              <td>
                  <button type="button"  link='{{val.id}}' data-linkname="{{val.linkname}}"  data-linkurl="{{val.linkurl}}" data-linkdesc="{{val.linkdesc}}" data-linkicon="{{val.linkicon}}"  class="layui-btn layui-btn-sm " >编辑</button>
                  <button type="button" data-id="{{val.id}}"  class="layui-btn layui-btn-sm layui-btn-danger" >删除</button></td>
            </tr>
        {{/each}}
     </script>

     <!-- 设置编辑弹出层模板 -->
     <script type="text/html" id="tpl-edit" >
      <form class="layui-form edit-form" action="" style="margin:20px" lay-filter="formTest">
        <div class="layui-form-item">
          <label class="layui-form-label">链接名称</label>
          <div class="layui-input-block">
            <input type="text" name="linkname" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">链接地址</label>
          <div class="layui-input-block">
            <input type="text" name="linkurl" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">链接描述</label>
          <div class="layui-input-block">
            <input type="text" name="linkdesc" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-form-item">
          <input type="file" id="file"  style="display:none;">
          <button type="button"  class="layui-btn" id="editPic" style="margin-left:110px">
           <i class="layui-icon">&#xe67c;</i>上传图片
          </button>
          <img  id="editImg" src="" alt=""  >
      </div>
        <div class="layui-form-item">
          <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
          </div>
        </div>
       </form> 
     </script>


      <!-- 设置添加弹出层模板 -->
      <script type="text/html" id="tpl-add" >
        <form class="layui-form add-form" action="" style="margin:20px" lay-filter="formTest">
          <div class="layui-form-item">
            <label class="layui-form-label">链接名称</label>
            <div class="layui-input-block">
              <input type="text" name="linkname" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">链接地址</label>
            <div class="layui-input-block">
              <input type="text" name="linkurl" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">链接描述</label>
            <div class="layui-input-block">
              <input type="text" name="linkdesc" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
            </div>
          </div>
          <div class="layui-form-item">
            <input type="file" id="file"  style="display:none;">
            <button type="button"  class="layui-btn" id="editPic" style="margin-left:110px">
             <i class="layui-icon">&#xe67c;</i>上传图片
            </button>
            <img  id="addtImg" src="" alt=""  >
        </div>
          <div class="layui-form-item">
            <div class="layui-input-block">
              <button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
              <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
          </div>
         </form> 
       </script>

  </div>
  <script src="../assets/lib/jquery.js"></script>
  <script src="../assets/lib/template-web.js"></script>
  <script src="../assets/js/common.js"></script>
  <script src="../assets/lib/layui/layui.all.js"></script>

  <script src="../assets/js/resourse/link.js"></script>

</body>

</html>